package electricity.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import electricity.dto.AlarmDto;
import electricity.dto.AlarmQueryDto;
import electricity.mapper.AlarmRecordMapper;
import electricity.service.AlarmService;
import electricity.vo.AlarmVO;
import electricity.vo.DeviceVO;
import electricity.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AlarmServiceImpl implements AlarmService {
    @Autowired
    private AlarmRecordMapper alarmRecordMapper;

    /**
     * 告警分页查询
     * @param alarmQueryDto
     * @return
     */
    public PageResult pageQuery(AlarmQueryDto alarmQueryDto) {
        PageHelper.startPage(alarmQueryDto.getPage(), alarmQueryDto.getPageSize());
        Page<AlarmVO> page = alarmRecordMapper.pageQuery(alarmQueryDto);
        return new PageResult(page.getTotal(), page.getResult());

    }

    /**
     * 处理告警
     * @param alarmDto
     */
    public void handle(AlarmDto alarmDto) {


            alarmRecordMapper.handle(alarmDto);


    }
}
